Learn R Programming

rstan (version 2.8.2)

Diagnostic plots: Diagnostic plots

Description

Diagnostic plots for HMC and NUTS using ggplot2.

Usage

stan_diag(object, 
            information = c("sample","stepsize", "treedepth","divergence"), 
            chain = 0, ...)
  stan_par(object, par, chain = 0, ...)
  
  stan_rhat(object, pars, ...)
  stan_ess(object, pars, ...)
  stan_mcse(object, pars, ...)

Arguments

object
A stanfit or stanreg object.
information
The information to be contained in the diagnostic plot.
par,pars
The name of a single scalar parameter (par) or one or more parameter names (pars).
chain
If chain=0 (the default) all chains are combined. Otherwise the plot for chain is overlaid on the plot for all chains combined.
...
For stan_diag and stan_par, optional arguments to arrangeGrob. For stan_rhat, stan_ess, and stan_mcse, optional argume

Value

  • For stan_diag and stan_par, a list containing the ggplot objects for each of the displayed plots. For stan_rhat, stan_ess, and stan_mcse, a single ggplot object.

Details

[object Object],[object Object],[object Object]

See Also

List of RStan plotting functions, Plot options

Examples

Run this code
fit <- stan_demo("eight_schools")

stan_diag(fit, info = 'sample') # shows three plots together
samp_info <- stan_diag(fit, info = 'sample') # saves the three plots in a list
samp_info[[3]] # access just the third plot

stan_diag(fit, info = 'sample', chain = 1) # overlay chain 1

stan_par(fit, par = "mu")

Run the code above in your browser using DataLab